package com.waiting.reflection;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author bjweitingting
 * @description
 * @date 2018/8/17
 **/
public class Test {


    public static void main(String[] args) {
        try {
            Class<?> test = Class.forName("com.waiting.reflection.Test");
            Method method = test.getMethod("target", int.class);
            System.out.println(method.toString());
            method.invoke(new Test(), 127);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
    public  void target(int param) {
        new Exception("#" + param).printStackTrace();
    }
}
